package com.JavaTest7;

import java.util.Scanner;

public class BookTest {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        BookManagement Bks = new BookManagement();
        int cnt;
        System.out.println("输入书本总数:");
        cnt = in.nextInt();
        for(int i = 0; i < cnt; i ++ ){
            String n, a, dt;
            System.out.println("输入书名,作者,日期(编号默认从10001开始)");
            n = in.next();
            a = in.next();
            dt = in.next();
            Bks.addBook(new Book(n, a, dt));
        }

        System.out.println("输入想要查看书本的编号(编号默认从10001开始):");
        int index = in.nextInt();
        System.out.println(Bks.searchBookByID(index));

        System.out.println("输入想要查看书本的书名:");
        String n = in.next();
        System.out.println(Bks.searchBookByName(n));

        System.out.println("-------------所有书籍信息-----------");
        Bks.printBookInfo();

        System.out.println("输入想要删除书本的编号(编号默认从10001开始):");
        int index2 = in.nextInt();
        Bks.deleteBook(index2);

        System.out.println("输入想要添加书本的编号(编号默认从10001开始):");
        int index3 = in.nextInt();
        Book NewBook = new Book();
        NewBook.setB_ID(index3);
//        System.out.println(NewBook.getB_ID());
        Bks.addBook(NewBook);

        System.out.println("-------------操作后-------------");
        Bks.printBookInfo();

        System.out.println("-------------排序后(降序)---------------");
        Bks.sortByID();
        Bks.printBookInfo();
    }
}
